#include <iostream>
#include <vector>
using namespace std;

int search(vector<int>& nums, int target) {
    int n = nums.size();
    if (n == 1) return (nums[0] == target) ? 0 : -1;
    int l = 0;
    int r = n-1;
    while(l < r){
        int mid = l + r + 1 >> 1;
        if(nums[mid] >= nums[0]){
            l = mid;
        }else{
            r = mid - 1;
        }
    }
    // 此时 l 和 r 都指向左段最大的元素的下标

    if(target < nums[0]){
        l = l + 1;
        r = n-1;
    }else{
        l = 0;
    }

    while(l <= r){
        int mid = l + r >> 1;
        if(nums[mid] == target){
            return mid;
        }else if(nums[mid] > target){
            r = mid - 1;
        }else{
            l = l + 1;
        }
    }
    return -1;
}

int main(){
    cout << "hello world" << endl;
    return 0;
}